import { Controller, Get, Req } from '@nestjs/common';
import { CaptchaService } from './captcha.service';
import { type Request } from 'express';
import { generateClientId } from 'src/common/utils/client.util';

@Controller('captcha')
export class CaptchaController {
  constructor(private readonly captchaService: CaptchaService) {}

  @Get()
  getCaptcha(@Req() req: Request) {
    const clientId = generateClientId(req);
    return this.captchaService.getCaptcha(clientId);
  }
}
